package com.example.books.Controller;

import com.example.books.Pojo.ClassifyDO;
import com.example.books.Service.ClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin //允许跨域请求
public class ClassifyController {

    @Autowired
    private ClassifyService classifyService;

    @PostMapping("/getClassify")
    public List<ClassifyDO> getClassify(){
        return classifyService.getClassify();
    }

    @PostMapping("/setClassify")
    public boolean setClassify(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return classifyService.setClassify(map);
    }

    @PostMapping("updateClassify")
    public boolean updateClassify(@RequestBody Map<String,Object> map){
        return classifyService.updateClassify(map);
    }

    @PostMapping("/deleteClassify")
    public boolean deleteClassify(@RequestBody Map<String,Object> map){
        return classifyService.deleteClassify(map);
    }
}
